package com.it.base.thread.pool.MyCustomThreadPool.ThreadFactory;

import java.util.concurrent.ThreadFactory;

/**
 * 定义线程池中的线程创建工厂
 */
public class MyThreadFactory implements ThreadFactory {
    @Override
    public Thread newThread(Runnable r) {
        //  只创建线程,交给线程池,启动时机由线程池实现来决定
        System.out.println("当前使用自定义工厂创建线程--");
        Thread thread = new Thread(r);
        return thread;
    }
}
